<template>
    <el-dialog title="重命名线程" :visible.sync="visible" @close="close">
        <el-input v-model="newName" placeholder="请输入新的线程名称" ></el-input>
        <span slot="footer" class="dialog-footer">
            <el-button @click="close">取消</el-button>
            <el-button type="primary" @click="confirmRename" :disabled="newName.trim().length<=0">确定</el-button>
        </span>
    </el-dialog>
</template>

<script>
export default {
    props: {
        visible: Boolean,
        threadSlug: String,
        workspaceSlug: String,
    },
    data() {
        return {
            newName: '',
        };
    },
    methods: {
        close() {
            this.$emit('close');
        },
        confirmRename() {
            if (this.newName.trim()) {
                this.$emit('rename', this.newName); // 发出重命名事件
            } else {
                this.$message.warning('名称不能为空');
            }
        }
    }
};
</script>

<style scoped>
/* 弹窗样式 */
</style>